UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Uw7uSlymBOpTRM9D0kX4ydUlEMgyI5WtHJtov0gdvDc=' 
WHERE 
  key_id = '1bd274f53aef9ef02f5908179169a3871980f4f864ff5284ea7927df0fce88e8' 
  AND (
    token = 'Uw7uSlymBOpTRM9D0kX4ydUlEMgyI5WtHJtov0gdvDc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042