UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YQdDsRDP1xn3iMN4R+O2RE6pXNJn5OPjuW6Q9kCuYbQ=' 
WHERE 
  key_id = '37528f1876e050e1fd9479cb2378c119c53efe71c73130d77571cec0370bee96' 
  AND (
    token = 'YQdDsRDP1xn3iMN4R+O2RE6pXNJn5OPjuW6Q9kCuYbQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00015