UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'jeRD1NgNaDJ7DZXCc8ERvdWe3XxIT2oaeaawcf5L2pQ=' 
WHERE 
  key_id = '4af6aa3f6bdcb1c898fe81df68700dd074248de246412fe421540efa72f8fa26' 
  AND (
    token = 'jeRD1NgNaDJ7DZXCc8ERvdWe3XxIT2oaeaawcf5L2pQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038