UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 's1UKzsXOQFDaca/YgZplXub/Mip0Mc2ViuQMsC2mzzE=' 
WHERE 
  key_id = 'a87e24e480e0e1753d380a19f2134284477af0662c5d5d0328960b713e62a508' 
  AND (
    token = 's1UKzsXOQFDaca/YgZplXub/Mip0Mc2ViuQMsC2mzzE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032