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