UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sK3aHCf/rqr7OOx5+Vuc198ousu19tFrIBJ+5c9PpX4=' 
WHERE 
  key_id = 'a0ab3fa1d82bf3bb2a6ae91a66c121050f414753e7229a5b8b3fbcfddbacee2b' 
  AND (
    token = 'sK3aHCf/rqr7OOx5+Vuc198ousu19tFrIBJ+5c9PpX4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027