UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Rvqul58BwhD0FWSN5c6VWxrpDELeB+aHvRPB3yDPwT0=' 
WHERE 
  key_id = 'b29d4d15fc14498e07d3e917b98dfb182bfbf318948cbb61ae339736576a8845' 
  AND (
    token = 'Rvqul58BwhD0FWSN5c6VWxrpDELeB+aHvRPB3yDPwT0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028