UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8/sKWcvNg9ti2+v1wAfOaABF8myx8uYadIJXk25r/jE=' 
WHERE 
  key_id = '5adc4cd23c5baf07970df7ab8665022f7ad0456cf06fe178eca6926a9ab2e96b' 
  AND (
    token = '8/sKWcvNg9ti2+v1wAfOaABF8myx8uYadIJXk25r/jE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045