UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Z7H5caCht+e+FB8D06XM6+e2p6d9cnSt5VYwpS30N7w='
WHERE
key_id = 'd4d405b905e5fe4708f244841beb9e5ac69f790fb048e89ec938737c7018a67f'
AND (
token = 'Z7H5caCht+e+FB8D06XM6+e2p6d9cnSt5VYwpS30N7w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)