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