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