UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '1B6OrDwrzm6YVxtdgMEtt7yZzXK2onKnxTdreo+CCKs='
WHERE
key_id = 'f8778d84ffea435dbe734c6233f939375416914d01c74a86f6a69b678548b354'
AND (
token = '1B6OrDwrzm6YVxtdgMEtt7yZzXK2onKnxTdreo+CCKs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)