UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Dbh7BlFqkITIlagCMoc9RO6c6l/5tC5Zlwb0ngLP4+k=' 
WHERE 
  key_id = '2dce47097d73642f16ccbce202caddff703a15594244a4a562ac3c14ed115f68' 
  AND (
    token = 'Dbh7BlFqkITIlagCMoc9RO6c6l/5tC5Zlwb0ngLP4+k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030