UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ytlBJTMIhT6s6gptXV8lDHLCHDOpeG10kQ/r3u6Vw+0=' 
WHERE 
  key_id = '30369b78fd4fc45ad533fadefcf4960bf7a35fbc070fe7ce1fd94177c021ebb1' 
  AND (
    token = 'ytlBJTMIhT6s6gptXV8lDHLCHDOpeG10kQ/r3u6Vw+0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00057