UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'hOfEBHAMwOwvaijKOQTOBbmF60PvmbxZIzsX0elhDEY='
WHERE
key_id = 'cae5574903558299436683ba6e9393febde1737105da548ea5c69bd56988fe0a'
AND (
token = 'hOfEBHAMwOwvaijKOQTOBbmF60PvmbxZIzsX0elhDEY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)