UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '+4hi8oirYnX3770/SXSOpZghG+lJR8TF921kZbCrG0w=' 
WHERE 
  key_id = '2a3b263b7ae54c5f8ac20981e619700c40eff23b34c56859c2a9cd340f1319e9' 
  AND (
    token = '+4hi8oirYnX3770/SXSOpZghG+lJR8TF921kZbCrG0w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044