UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KRROvLvUihrUIAjY1tQGwGaIwOg1jJa9dm3SEOGUy7E='
WHERE
key_id = 'b8eb031a0df41d8fb8807fa5e829d4073fb560a817cb8bc27634e0d7bded1474'
AND (
token = 'KRROvLvUihrUIAjY1tQGwGaIwOg1jJa9dm3SEOGUy7E='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)