UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'cOSQz41zZzI7qVwe+Adw2+oAeHT+IOU/aZD7Bb9Gyfw='
WHERE
key_id = '99e2dc3ac4b788dd7798f46f701d878c77db427542fe258c99d911059a3e3687'
AND (
token = 'cOSQz41zZzI7qVwe+Adw2+oAeHT+IOU/aZD7Bb9Gyfw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)