UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'P9IegxsFLTJ2SRnXEQGwgTtNNCL+7tmZLMZgTp+k9kg=' 
WHERE 
  key_id = 'e2423596a3af3ffb8be02bddce302cd7d63116c3c4b2c2acf4971e2aca15018d' 
  AND (
    token = 'P9IegxsFLTJ2SRnXEQGwgTtNNCL+7tmZLMZgTp+k9kg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032