UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ibz8g9f93VduJvxhlXUW78X216Zhr2zdoBqJAtgyDMo='
WHERE
key_id = '46cc1027cb3a5a5975b9481bc9bc9e7e6a11984432059133c201536f8a3891ef'
AND (
token = 'ibz8g9f93VduJvxhlXUW78X216Zhr2zdoBqJAtgyDMo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)