UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'pjJ3HudMjpg45fIz5qlulvOvTE21YVzJIYiwiJTdQm0='
WHERE
key_id = '5c8255fe7835604f0aa48cad41d1d407f1823fe7b93db5e9bd5dd6639b2f713d'
AND (
token = 'pjJ3HudMjpg45fIz5qlulvOvTE21YVzJIYiwiJTdQm0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)