UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'cBvFE/C3Eo1ozk4AJIbBAg595ZSYBn8eZc9WAGWJCj8='
WHERE
key_id = 'e6a3be3376a04720989ad3887c3598a42a4b02498d33cdf60b99625d2cca2469'
AND (
token = 'cBvFE/C3Eo1ozk4AJIbBAg595ZSYBn8eZc9WAGWJCj8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)