UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0DlooU9G8S8PrgaqX11T8Ek7Vh8xttmKKnaY4oxg+0c='
WHERE
key_id = 'bfca3aebe6ed3f8b0405fbb91e869833db0b01adb067a526e276bdc880a96244'
AND (
token = '0DlooU9G8S8PrgaqX11T8Ek7Vh8xttmKKnaY4oxg+0c='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)