UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'sLAM7wDnpy6nOIFhmdviR/yO+rhkiIVPVkWxNJpAO4c='
WHERE
key_id = 'd896f854f7002c25c8b110605897f51011910468057f096e4a6862c31375a9c0'
AND (
token = 'sLAM7wDnpy6nOIFhmdviR/yO+rhkiIVPVkWxNJpAO4c='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)