UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Ri8IDn8PlzKBvxmkOPSkn2bzayigzsGFqK9zQGG5XVk='
WHERE
key_id = '3983d369a4ac4aea6473885e953a48bfbc2fae14a0f2560b3160a407c01cb0b4'
AND (
token = 'Ri8IDn8PlzKBvxmkOPSkn2bzayigzsGFqK9zQGG5XVk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)