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