UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NH3UGUDyMuJ9HMzl0LwmTxlHdm0xnZgQYvaK8am7w4I=' 
WHERE 
  key_id = '666ae33b9daf2b5055d8f0bfa92115ae89465a6563b2bc221d4919ccddcc613d' 
  AND (
    token = 'NH3UGUDyMuJ9HMzl0LwmTxlHdm0xnZgQYvaK8am7w4I=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023