UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '2NMT3QPedf7e3pBfT563IaIVpDYZSw+fV4hRivnKka0=' 
WHERE 
  key_id = 'e03218220f5bb674259212370a03844086ff88ae93e8992eb2245527080972e4' 
  AND (
    token = '2NMT3QPedf7e3pBfT563IaIVpDYZSw+fV4hRivnKka0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028