UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YdYJYgmemQ0uZbIW3EK7i8yNdHMU6pgOzWDvICflH+Y=' 
WHERE 
  key_id = '3f66c465fa6216a186f3d4a03255ae2ca8133aba51d90f43685d13bee2e20403' 
  AND (
    token = 'YdYJYgmemQ0uZbIW3EK7i8yNdHMU6pgOzWDvICflH+Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025