UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tr7xbT/VCg/n4/0AMCYP0KpKdhO1+tu8bnP7dA7hEuo=' 
WHERE 
  key_id = 'b5da2e870230a3a2042487adc461c1ba034e1ae9db104c416eff46fedaa51426' 
  AND (
    token = 'tr7xbT/VCg/n4/0AMCYP0KpKdhO1+tu8bnP7dA7hEuo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023