UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lHw6e0t1e3W+gm8PatecOEoJlPFu3OMWWv2eZFzXlmo=' 
WHERE 
  key_id = '52d4584011e595b83654334bddfb27738f21bd2f6b6b09acdde666ad58d7571d' 
  AND (
    token = 'lHw6e0t1e3W+gm8PatecOEoJlPFu3OMWWv2eZFzXlmo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044