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