UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'g0lpO+OWwfqEE3N8E/7xhHPV2FJF1TWvd6HrKqtO2nE=' 
WHERE 
  key_id = '215a3e21a49b5c7783de1c05e43262ecc6bbc9fd753f0d136fe7448b06fc177f' 
  AND (
    token = 'g0lpO+OWwfqEE3N8E/7xhHPV2FJF1TWvd6HrKqtO2nE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030