UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'JB8Nh+dwifoCvR1ZO0k7wssAzI55RyBKAXBZL0mWQzM='
WHERE
key_id = 'c8e1f4892d162c935d5d2ab23d3e76bcf71e5eb31f3898192dd50652f3803769'
AND (
token = 'JB8Nh+dwifoCvR1ZO0k7wssAzI55RyBKAXBZL0mWQzM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)