UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YLACOs+1Pvsex23l+6yc6/k3r0wCuzmsKX4jU2znTg0=' 
WHERE 
  key_id = '946dfb81ce295300fcbdf4ae1866b98e89071ea7124ef4fe6ff96051d549fc3e' 
  AND (
    token = 'YLACOs+1Pvsex23l+6yc6/k3r0wCuzmsKX4jU2znTg0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046