UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'aS+7nsOcfmE90eFk4gsE9bBhchz3YzlMtrGqY7Xe/Ok='
WHERE
key_id = 'ec8684898205b46efd2ad6343cb2ea87c5ad6ac609225f8e396bff538777c0f5'
AND (
token = 'aS+7nsOcfmE90eFk4gsE9bBhchz3YzlMtrGqY7Xe/Ok='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)