UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'bVx325ZFdrRnzYGcccIS5gcvtUR1b/lmfQSqKzdxfM4='
WHERE
key_id = 'f50e4e9e66f20cc089452c8d0be9518448a70b435f421af6f24294d8e79c26f6'
AND (
token = 'bVx325ZFdrRnzYGcccIS5gcvtUR1b/lmfQSqKzdxfM4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)