UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'jgzbAK0pVhs5jqrUyL5JwJXfJNFPSu3K8esNYYKRGn0='
WHERE
key_id = '38dbf78e91a959077bbe47cc91dc7d30f0874e00e74f1399e8e41da40344d278'
AND (
token = 'jgzbAK0pVhs5jqrUyL5JwJXfJNFPSu3K8esNYYKRGn0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)