UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8gWAPWH9zWLdM3vdPvrAYeyh8IqpKA+RgT6h/KPQHVI='
WHERE
key_id = 'e8e61eb53f0b94401e7c9d19cf572d2c09f121faedf851da318913e129b1d1e2'
AND (
token = '8gWAPWH9zWLdM3vdPvrAYeyh8IqpKA+RgT6h/KPQHVI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)