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