UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZRgA2dGl9MHNMdubhas722/eSM4mRHtplQOEZaoo+ec=' 
WHERE 
  key_id = 'f13c616681b52547d15f0acf92fc4d53942f38f0591af27db63f40278568c603' 
  AND (
    token = 'ZRgA2dGl9MHNMdubhas722/eSM4mRHtplQOEZaoo+ec=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023