UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'PcHhX2GEhTParzUh7d+CqH3V/w3cr8qyEXlQgNcN3eQ=' 
WHERE 
  key_id = '4cb85b8d54f06ebe6374b14fbda9b69d77481b142cc728e65df3cd7803c9b9a2' 
  AND (
    token = 'PcHhX2GEhTParzUh7d+CqH3V/w3cr8qyEXlQgNcN3eQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026