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