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