UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '5reJ0MESguiQyPqTQLonBpzez6ks5jvC84oLGszc1MU=' 
WHERE 
  key_id = '5af9656eab0033a17a681eace3b97b1d48823310246b8fbb5ae54762298c83a4' 
  AND (
    token = '5reJ0MESguiQyPqTQLonBpzez6ks5jvC84oLGszc1MU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00056