UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'SdVtLBsHK7KytZSQ59GB2ko/DsqI66dF/oS5mRj7gyw='
WHERE
key_id = 'ba9cc92732fcfe12a83dce7079846fba3a7153dc36e8409d24bc6cb89805350e'
AND (
token = 'SdVtLBsHK7KytZSQ59GB2ko/DsqI66dF/oS5mRj7gyw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)