UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '9R9s6tDuDTobOkv4zaewpt7yECF7tI633Rj+M6mXvO4='
WHERE
key_id = '109ae1fe19cf4b40db44b08f66d7919ef7ff453904cfbbb158d09d2319eea130'
AND (
token = '9R9s6tDuDTobOkv4zaewpt7yECF7tI633Rj+M6mXvO4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)