UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'i0ohPhQcYSXuod6hIpLKT+QlIdAoVpqAdf59rBkCMe8=' 
WHERE 
  key_id = 'dec1972e30252977db31cae0e871bef5e4a80dbb2e9efcd4bd926ed4a2f320cc' 
  AND (
    token = 'i0ohPhQcYSXuod6hIpLKT+QlIdAoVpqAdf59rBkCMe8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00049