UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'FLys+08jOSP446H0SquqZCmYSifiL5t37lhWoS00fyM=' 
WHERE 
  key_id = '5b2eb99733e5d6e390dcde2295453c85f69308239d7f4e006ac644859973aeb1' 
  AND (
    token = 'FLys+08jOSP446H0SquqZCmYSifiL5t37lhWoS00fyM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032