UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '249few0+P8DCz+2lVQp7G5u+A4+hR2ighUBoKfLAMPw=' 
WHERE 
  key_id = '6fe0733198e8860bd02e51a53cf7ce3d9a7af18961c39ea3cc7114187226a822' 
  AND (
    token = '249few0+P8DCz+2lVQp7G5u+A4+hR2ighUBoKfLAMPw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037