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