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

Query time 0.00043