UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BNPPQMgUAzIAZc3bLzW3X5nKS9maDvw0yH0bZ1U2+NM=' 
WHERE 
  key_id = '91e3fade466885eeaa57c4c8d27aacd255e938bd5ba0e427566dac65d8da382a' 
  AND (
    token = 'BNPPQMgUAzIAZc3bLzW3X5nKS9maDvw0yH0bZ1U2+NM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028