UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'm3OnPlF4thSKzwYRhFnR7gM9ePlRXMEfF/y7SNsuCEI='
WHERE
key_id = 'f7b47afac50b063bc977408261a94315f6683776f41f486d9fb1641c1c7a9546'
AND (
token = 'm3OnPlF4thSKzwYRhFnR7gM9ePlRXMEfF/y7SNsuCEI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)