UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'YnN6IzqiIchztlWAU8AyLjjh1WJy8dzzr+ZHBQ+dlEE='
WHERE
key_id = '9c57780015ded4623e47985301a85cf0e4f1c4774d6637ad06e803686a4a2736'
AND (
token = 'YnN6IzqiIchztlWAU8AyLjjh1WJy8dzzr+ZHBQ+dlEE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)