UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BgVy9dSf/47bTbc+UKL1pRbe8vEh6KUg5SHxPa89ghU='
WHERE
key_id = 'f07968463406453e4f25dc966c07cec046d2b0e2297726dfdd02410f67eb7c76'
AND (
token = 'BgVy9dSf/47bTbc+UKL1pRbe8vEh6KUg5SHxPa89ghU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)